package Proxy;

/**
 * tank的代理
 * 聚合的方式实现代理
 */
public class TimeTankProxy implements Movable {
    private Movable tank; // Tank是被代理人 TimeTankProxy是代理人

    public TimeTankProxy(Movable m) {
        this.tank = m;
    }

    @Override
    public void move() {
        long start = System.currentTimeMillis();

        tank.move();

        long end = System.currentTimeMillis();

        System.out.println("方案二" + (end - start));
    }

    public void before() {
        System.out.println("before");
    }

    public void after() {
        System.out.println("after");
    }
}
